using UnityEngine;
using System.Collections;

public class ElectrifiedFloorOnState : State<ElectrifiedFloorControl>
{
    #region Singleton

    private static ElectrifiedFloorOnState instance = new ElectrifiedFloorOnState();
    public static ElectrifiedFloorOnState Instance { get { return instance; } }
    private ElectrifiedFloorOnState() { }

    #endregion

    #region State

    public override void OnEnter(ElectrifiedFloorControl behaviour)
    {
        behaviour.effect.SetActiveRecursively(true);
        behaviour.SetTimeToChangeState(behaviour.timeIsOn);
    }

    public override void OnUpdate(ElectrifiedFloorControl behaviour)
    {
        if (behaviour.IsTimeToChangeState())
            behaviour.State = ElectrifiedFloorOffState.Instance;        
    }

    public override void OnExit(ElectrifiedFloorControl behaviour)
    {
    }

    public override void OnAction(string name, ElectrifiedFloorControl behaviour, object value = null)
    {
    }

    #endregion
}
